home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / fmodla13.zip / DIRECTOR.DEF < prev    next >
Text File  |  1992-01-29  |  3KB  |  131 lines

  1. DEFINITION MODULE Directories;
  2.  
  3. (* (C) Copyright 1987 Fitted Software Tools. All rights reserved. *)
  4.  
  5.  
  6. TYPE DirEntry = RECORD
  7.                   name      :ARRAY [0..65] OF CHAR;
  8.                   attribute :BITSET;
  9.                   time      :CARDINAL;
  10.                   date      :CARDINAL;
  11.                   size      :LONGCARD;
  12.                 END;
  13.  
  14. CONST  (* directory entry attributes bits *)
  15.     NORMAL      = {};
  16.     READONLY    = {0};
  17.     HIDDEN      = {1};
  18.     SYSTEM      = {2};
  19.     DIRECTORY   = {4};
  20.     ARCHIVE     = {5};
  21.  
  22.  
  23. (* === Low level directory access === *)
  24.  
  25. PROCEDURE GetFirstDir( Path :ARRAY OF CHAR; Attribute :BITSET;
  26.                        VAR Dir :DirEntry; VAR ok :BOOLEAN );
  27. (*
  28.     on return:
  29.     IF ok THEN
  30.         Dir is the first directory entry that matches Path & Attribute
  31.     END;
  32. *)
  33.  
  34. PROCEDURE GetNextDir( VAR Dir :DirEntry; VAR ok :BOOLEAN );
  35. (*
  36.     on return:
  37.     IF ok THEN
  38.         Dir is the next directory entry to match the Path and Attribute
  39.         of the last GetFirstDir or GetNextDir.
  40.     END;
  41. *)
  42.  
  43.  
  44. (* === High level directory access === *)
  45.  
  46. TYPE QueryProc = PROCEDURE( DirEntry );
  47.  
  48. PROCEDURE DirQuery( path :ARRAY OF CHAR; attributes :BITSET; p :QueryProc );
  49. (*
  50.     invokes p for every directory entry that matches path and attributes,
  51.     passing along the directory entry.
  52. *)
  53.  
  54.  
  55. (* === Directory manipulation procedures === *)
  56.  
  57. VAR DirStatus   :CARDINAL;      (* DOS status after last procedure call *)
  58.  
  59. (*
  60.     in the following procedures, fileName and dirName are any valid
  61.     path name, including a drive specification if so desired.
  62. *)
  63.  
  64. PROCEDURE MkDir( dirName :ARRAY OF CHAR );
  65. (*
  66.     make a new directory
  67. *)
  68.  
  69. PROCEDURE RmDir( dirName :ARRAY OF CHAR );
  70. (*
  71.     remove directory dirName
  72. *)
  73.  
  74. PROCEDURE ChDir( dirName :ARRAY OF CHAR );
  75. (*
  76.     change the current directory to dirName
  77. *)
  78.  
  79. PROCEDURE GetFileAttr( fileName :ARRAY OF CHAR; VAR attr :BITSET );
  80. (*
  81.     get the attribute bits for file fileName
  82. *)
  83.  
  84. PROCEDURE SetFileAttr( fileName :ARRAY OF CHAR; attr :BITSET );
  85. (*
  86.     set the file attribute bits
  87. *)
  88.  
  89. PROCEDURE GetCurDir( drive :CARDINAL; VAR curDir :ARRAY OF CHAR );
  90. (*
  91.     get the current directory for the specified drive, where:
  92.       drive = 0     - current drive
  93.             = 1     - drive A
  94.             = 2     - drive B
  95.             ...
  96. *)
  97.  
  98. PROCEDURE Delete( fileName :ARRAY OF CHAR );
  99. (*
  100.     delete the file fileName
  101. *)
  102.  
  103. PROCEDURE Rename( oldName, newName :ARRAY OF CHAR );
  104. (*
  105.     rename the file oldName as newName.
  106.  
  107.     Rename may be used to move a file to another directory in the
  108.     same drive.
  109. *)
  110.  
  111. PROCEDURE GetFileTime( fileName :ARRAY OF CHAR; VAR time :LONGCARD );
  112. (*
  113.     returns in time the date and time of last modification of the file
  114.     fileName.
  115.  
  116.     time DIV 65536L = date of last modification
  117.     time MOD 65536L = time of last modification
  118.  
  119. *)
  120. PROCEDURE SetFileTime( fileName :ARRAY OF CHAR; time :LONGCARD );
  121. (*
  122.     Sets the file's modification date and time.
  123. *)
  124.  
  125. PROCEDURE ASCIIZ( VAR src, dest :ARRAY OF CHAR );
  126. (*
  127.     converts the string src into a null terminated string in dest.
  128.     used by procedures from Files.
  129. *)
  130.  
  131. END Directories.